package com.tomehay.termprojectmanage_server.controller;


import com.tomehay.termprojectmanage_server.pojo.Model.Termproject;
import com.tomehay.termprojectmanage_server.pojo.VO.ResultVO;
import com.tomehay.termprojectmanage_server.pojo.VO.TermProjectVO;
import com.tomehay.termprojectmanage_server.service.TermprojectService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tomehay
 * @since 2023-06-20
 */
@RestController
@RequestMapping("api/termProject")
public class TermProjectController {

    @Autowired
    TermprojectService termprojectService;

    @GetMapping("GetTermProjectByCourseId")
    public ResultVO<List<Termproject>> GetTermProjectByCourseId(int course_id){
        return termprojectService.GetTermProjectByCourseId(course_id);
    }

    @GetMapping("/GetTermProjectByCourseIdAndStudentId")
    public ResultVO<List<TermProjectVO>> GetTermProjectByCourseIdAndStudentId(int course_id, int student_id){
        return termprojectService.GetTermProjectByCourseIdAndStudentId(course_id,student_id);
    }

    @DeleteMapping("DeleteTermProjectById")
    public ResultVO<Void> DeleteTermProjectById(int id){
        return termprojectService.DeleteTermProjectById(id);
    }

    @PostMapping("CreateTermProject")
    public ResultVO<Void> CreateTermProject(@RequestBody Termproject termproject){
        return termprojectService.CreateTermProject(termproject);
    }

    @PostMapping("UpDateTermProject")
    public ResultVO<Void> UpDateTermProject(@RequestBody Termproject termproject){
        return termprojectService.UpDateTermProject(termproject);
    }
}
